﻿using System;
using System.ComponentModel;
using System.Diagnostics;
namespace TciNewsReader_2014_04.VmHelpers
{// menu support for item inclusion/exclusion based upon item age (i.e., 1 hour)
    public class AgeInfo : INotifyPropertyChanged
    {// binded to the menu
        private bool _isChecked;
        public bool IsChecked
        {
            [DebuggerStepThrough]
            get { return _isChecked; }
            [DebuggerStepThrough]
            set
            {
                if (value != _isChecked)
                {
                    _isChecked = value;
                    OnPropertyChanged("IsChecked");
                }
            }
        }
        public string Description { get; set; }
        public double HourOffsetFromNow { get; set; }
        #region INotifyPropertyChanged Implementation
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string name)
        {
            var handler = System.Threading.Interlocked.CompareExchange(ref PropertyChanged, null, null);
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }
        #endregion
        public override string ToString()
        {
            return String.Format("{0} | {1}", Description, IsChecked);
        }
    }
}